/**
 * 
 */
package jvs.vfs.opt.media;

import java.io.IOException;
import java.io.InputStream;

import jvs.vfs.opt.browse.BookmarkFileImpl;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

/**
 * @author qiangli
 * 
 */
public final class Icons {
	public static Bitmap ICON_UNKNOWN;

	public static Bitmap ICON_ALBUM;

	public static Bitmap ICON_ARTIST;

	public static Bitmap ICON_PLAYLIST;

	public static Bitmap ICON_SONG;

	public static Bitmap ICON_GALLERY;
	static {
		try {
			ICON_UNKNOWN = loadIcon("/jvs/vfs/opt/media/albumart_unknown.png");
			ICON_ALBUM = loadIcon("/jvs/vfs/opt/media/album.png");
			ICON_ARTIST = loadIcon("/jvs/vfs/opt/media/artist.png");
			ICON_PLAYLIST = loadIcon("/jvs/vfs/opt/media/playlist.png");
			ICON_SONG = loadIcon("/jvs/vfs/opt/media/song.png");
			ICON_GALLERY = loadIcon("/jvs/vfs/opt/media/gallery.png");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	private static Bitmap loadIcon(String res) throws IOException {
		InputStream is = BookmarkFileImpl.class.getResourceAsStream(res);
		try {
			BitmapFactory.Options opts = new BitmapFactory.Options();
			opts.inPreferredConfig = Bitmap.Config.ARGB_8888;
			Bitmap bm = BitmapFactory.decodeStream(is, null, opts);
			return bm;
		} finally {
			is.close();
		}
	}

	private Icons() {
	}
}
